from google.appengine.ext import webapp
from google.appengine.ext.webapp.util import run_wsgi_app
import datetime,re,os


class MainHandler(webapp.RequestHandler):
  def __init__(self):
    pass

  def get(self ):

# http://vancouver-webpages.com/META/FAQ.html#redirect

# http://code.google.com/appengine/docs/python/tools/webapp/redirects.html
    url = "http://"+os.environ["SERVER_NAME"]
    if (re.search("localhost",url )): url = "http://localhost:8080"

    self.redirect(url+"/tourny?display=508303512")
#   self.redirect("http://www.tennisratings.appspot.com/tourny?display=508303512")


def main():
    application = webapp.WSGIApplication(
          [ ('/', MainHandler)
          ], debug=True)
    run_wsgi_app(application)

if __name__ == '__main__':
  main()
